﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Kinect;

namespace ISMOT.HCI.KGL
{
    public class GesturePack
    {
        public GesturePack()
        {
            this.Gestures = new List<Gesture>();
        }

        private List<Gesture> Gestures { get; set; }

        public void AddGesture(Gesture gesture)
        {
            this.Gestures.Add(gesture);
        }

        public event EventHandler<GestureHitEventArgs> GestureHit;
        protected virtual void OnGestureHit(GestureHitEventArgs args)
        {
            if (GestureHit != null)
                GestureHit(null, args);
        }

        public void CheckForGestures(Skeleton body)
        {
            foreach (var gesture in this.Gestures)
            {
                if (gesture.IsHit(body))
                    this.OnGestureHit(new GestureHitEventArgs()
                    {
                        Body = body,
                        Gesture = gesture,
                    });
            }
        }
    }
}
